package tech.aistar.service.collecte.Impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.aistar.entity.Collecte;
import tech.aistar.mapper.collecte.CollecteMapper;
import tech.aistar.service.collecte.ICollecteService;

import java.util.List;

/**
 * Created by Administrator on 2019/9/27 0027.
 */
@Service
@Transactional
public class CollecteServiceImpl implements ICollecteService {
    @Autowired
    private CollecteMapper collecteMapper;
    @Override
    public List<Collecte> coldelById(Integer id) {
        collecteMapper.coldelById(id);
        return null;
    }

    @Override
    public Integer del(Integer servicesId) {
        collecteMapper.del(servicesId);
        return servicesId;
    }

    @Override
    public List<Collecte> colFindAll() {
        List<Collecte> collecteList = collecteMapper.colFindAll();
        return  collecteList;
    }

    @Override
    public List<Collecte> coluserFindOne(Integer userinfoId) {
        List<Collecte> collecteList2 = collecteMapper.coluserFindOne(userinfoId);
        return collecteList2;
    }

    @Override
    public void colSave(Collecte collecte) {
        collecteMapper.colSave(collecte);
    }

    @Override
    public List<Collecte> serviceFind(Integer servicesId) {
        List<Collecte> collecteList3 = collecteMapper.serviceFind(servicesId);
        return  collecteList3;
    }

    @Override
    public PageInfo<Collecte> findAll(Integer userinfoId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);

        List<Collecte> pageList = collecteMapper.coluserFindOne(userinfoId);

        PageInfo<Collecte> pageInfo = new PageInfo<>(pageList);
        return pageInfo;
    }


}
